package com.qm.console.pubdef.pubenum;

/**
 * @Auther: yilu
 * @Date: 2019/3/14 11:10
 * @Description:
 */
public enum SystemTypeEnum {
    android("android", "android"),
    ios("ios", "iOS"),

    ;
    private String systemLowerName;
    private String systemStandardName;

    SystemTypeEnum(String systemLowerName, String systemStandardName) {
        this.systemLowerName = systemLowerName;
        this.systemStandardName = systemStandardName;
    }

    public String getSystemLowerName() {
        return systemLowerName;
    }

    public String getSystemStandardName() {
        return systemStandardName;
    }

    public static String getStandardNameByAppVersion(String appVersion){
        String systemName = ios.systemStandardName;
        if(appVersion == null){
            return systemName;
        }
        String system = appVersion.split("_")[0].toLowerCase();

        for(SystemTypeEnum typeEnum: values()){
            if(typeEnum.systemLowerName.equals(system)){
                systemName = typeEnum.systemStandardName;
            }
        }
        return systemName;
    }
}
